<?php
/**
 * @Author:      lyt
 * @DateTime:    2016-02-22 18:04:28
 * @Description: 用于 客户端的资源类
 */
class CustomCommController extends BaseController {
   

    /**
     * @Author:      lyt
     * @DateTime:    2016-02-22 16:43:43
     * @Description: 用户客户端系统的升级 
     */
    public function app_version(){
        $validator = Validator::make(Input::all(),
            array(
                'version_code' => 'required',
            )
        );

        $response = array('code' => 0, 'msg' => 'ok', 'result' => array());
        do {
            if ($validator->fails()) {
                $response = Lang::get("sce_error.login_args_error_1001");
                break;
            }
            if(Input::get("version_code")!=Config::get("version_code.version")){
                $result=array("is_upgrade"=>1,"version_code"=>Config::get("app_version.version"),"url"=>Config::get("app_version.url"));
            }else{
                $result=array("is_upgrade"=>0,"version_code"=>Config::get("app_version.version"),"url"=>Config::get("app_version.url"));
            }            
            $response = array('code' => 0, 'msg' => 'ok', 'result' => $result);
        } while (false);
        Log::info("info", array("system" => "sce" ,"event" => "car_no_area", 'input' =>Input::all() ,"output" => $response));
        return json_encode($response);
    }
}